<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>闪灵快手 - Geistes</title>
    <link rel="stylesheet" href="/css/style.css">
    <style>
        /* 卡牌样式 */
        .geistes-card {
            width: 258px;
            height: 380px;
            margin: 20px auto;
            border: 0px solid #ffffff;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            text-align: center;
            background: #fff;
            position: relative;
            perspective: 1000px;
        }

        .card-image {
            width: 100%;     /* 图片宽度充满容器 */
            height: 100%;    /* 图片高度充满容器 */
            object-fit: cover; /* 关键：保持比例，裁剪多余部分（填满容器） */
            backface-visibility: visible; /* 显示背面，让翻转过程中卡牌可见 */
        }

        /* 卡牌翻转动画 - 翻转到背面（0度到180度） */
        .card-flip-back-to-180 {
            animation: flipToBack180 0.6s ease-in-out forwards;
        }

        /* 卡牌翻转动画 - 从背面翻转回正面（180度到0度） */
        .card-flip-front-from-180 {
            animation: flipToFrontFrom180 0.6s ease-in-out forwards;
        }

        @keyframes flipToBack180 {
            0% {
                transform: rotateY(0deg);
            }
            100% {
                transform: rotateY(180deg);
            }
        }

        @keyframes flipToFrontFrom180 {
            0% {
                transform: rotateY(180deg);
            }
            100% {
                transform: rotateY(0deg);
            }
        }

        .geistes-token img {
            width: 80%; /* 图片宽度为容器的 80%，留一点边距 */
            height: 80%; /* 高度同宽度，保持比例 */
            object-fit: contain; /* 保持图片比例，完整显示在容器内 */
        }

        /* 5个Token样式（横向排列） */
        .geistes-tokens {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin: 30px auto;
        }

       /* 基础 Token 样式 */
        .geistes-token {
            width: 100px;
            height: 100px;
            border: 2px solid #333;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #fff;
            cursor: pointer;
            transition: all 0.2s;
            overflow: visible;
            position: relative;
        }

        /* 默认悬停效果（仅对正常状态的 Token 生效） */
        .geistes-token:not(.is-correct):not(.is-wrong):not(.disabled):hover {
            transform: scale(1.05);
            border-color: #ff6b6b;
        }

        /* 禁用状态样式 */
        .geistes-token.disabled {
            pointer-events: none;
            cursor: default;
            opacity: 0.6;
            transition: opacity 0.3s ease;
        }

        /* 1. 错误状态（is-wrong） */
        .geistes-token.is-wrong {
            /* 错误 Token 自身禁用悬停效果 */
            cursor: default;
        }
        .geistes-token.is-wrong:hover {
            transform: none; /* 取消放大 */
            border-color: #333; /* 取消红色边框 */
        }
        /* 错误标记（叉号）显示 */
        .token-cross {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 50%;
            height: 50%;
            object-fit: contain;
            display: none; /* 默认隐藏 */
            z-index: 10;
        }
        .geistes-token.is-wrong .token-cross {
            display: block; /* 错误时显示叉号 */
        }

        /* 2. 正确状态（is-correct） */
        /* 当存在任意正确 Token 时，所有 Token 锁定 */
        .geistes-tokens:has(.geistes-token.is-correct) .geistes-token {
            pointer-events: none; /* 所有 Token 禁用点击/悬停 */
            cursor: default;
        }

        /* 正确标记（对勾）显示 */
        .token-checkmark {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 50%;
            height: 50%;
            object-fit: contain;
            display: none; /* 默认隐藏 */
            z-index: 10;
        }
        .geistes-token.is-correct .token-checkmark {
            display: block; /* 正确时显示对勾 */
        }

        /* 玩家标签样式 */
        .token-player-label {
            position: absolute;
            top: -12px;
            right: -12px;
            background: #ff6b6b;
            color: white;
            font-size: 10px;
            font-weight: bold;
            padding: 2px 6px;
            border-radius: 8px;
            min-width: 20px;
            text-align: center;
            display: none;
            z-index: 20;
            box-shadow: 0 2px 4px rgba(0,0,0,0.3);
            border: 2px solid white;
        }
        .geistes-token.has-player .token-player-label {
            display: block;
        }

  /* 分数面板 - 优化后的排行榜 */
        .geistes-scores {
            text-align: center;
            margin: 15px auto;
            font-size: 14px;
            max-width: 300px;
        }
        
        .score-item {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 4px 0;
            padding: 8px 10px;
            background: #f8f9fa;
            border-radius: 6px;
            border: 2px solid transparent;
            transition: all 0.3s ease;
            font-weight: 500;
        }
        
        .player-info {
            flex: 1;
        }
        
        .player-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 4px;
        }
        
        .score-item.first-place {
            background: linear-gradient(135deg, #ffd700, #ffed4e);
            border-color: #ffd700;
            box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
            transform: scale(1.02);
        }
        
        .score-item.second-place {
            background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
            border-color: #c0c0c0;
            box-shadow: 0 2px 6px rgba(192, 192, 192, 0.3);
        }
        
        .score-item.third-place {
            background: linear-gradient(135deg, #cd7f32, #daa520);
            border-color: #cd7f32;
            box-shadow: 0 2px 6px rgba(205, 127, 50, 0.3);
        }
        
        .rank-icon {
            font-size: 18px;
            margin-right: 8px;
        }
        
        .player-name {
            flex: 1;
            text-align: left;
            font-weight: 600;
            font-size: 13px;
        }
        
        .player-score {
            font-weight: 700;
            color: #2c3e50;
            font-size: 13px;
        }
        
        .first-place .player-score {
            color: #8b4513;
        }
        
        /* 进度条样式 */
        .progress-bar-container {
            height: 6px;
            background: rgba(0, 0, 0, 0.1);
            border-radius: 3px;
            overflow: hidden;
        }
        
        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #4CAF50, #45a049);
            border-radius: 3px;
            transition: width 0.5s ease;
        }
        
        .first-place .progress-bar {
            background: linear-gradient(90deg, #ff6b35, #ff8e53);
        }
        
        .second-place .progress-bar {
            background: linear-gradient(90deg, #6c757d, #495057);
        }
        
        .third-place .progress-bar {
            background: linear-gradient(90deg, #dc3545, #c82333);
        }
        
        /* 游戏结束样式 */
        .game-end-message {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            padding: 20px;
            border-radius: 12px;
            margin: 20px auto;
            max-width: 400px;
            text-align: center;
            box-shadow: 0 8px 24px rgba(0,0,0,0.3);
        }
        
        .game-end-message h2 {
            margin: 0 0 10px 0;
            font-size: 28px;
        }
        
        .game-end-message h3 {
            margin: 10px 0;
            font-size: 24px;
            color: #ffd700;
        }
        
        .game-end-message p {
            margin: 10px 0 0 0;
            font-size: 16px;
            opacity: 0.9;
        }
        
        /* 游戏结束弹窗样式 */
        .game-end-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            animation: fadeIn 0.3s ease;
        }
        
        .modal-content {
            background: white;
            border-radius: 16px;
            padding: 30px;
            max-width: 500px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
            animation: slideUp 0.3s ease;
        }
        
        .modal-header {
            text-align: center;
            margin-bottom: 25px;
        }
        
        .modal-title {
            font-size: 28px;
            margin: 0 0 10px 0;
            color: #2c3e50;
        }
        
        .modal-subtitle {
            font-size: 18px;
            color: #7f8c8d;
            margin: 0;
        }
        
        .modal-leaderboard {
            margin-bottom: 25px;
        }
        
        .modal-leaderboard .score-item {
            margin: 6px 0;
            padding: 12px 16px;
            font-size: 16px;
        }
        
        .modal-leaderboard .rank-icon {
            font-size: 20px;
        }
        
        .modal-leaderboard .player-name {
            font-size: 15px;
        }
        
        .modal-leaderboard .player-score {
            font-size: 15px;
        }
        
        .modal-actions {
            text-align: center;
        }
        
        .modal-button {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .modal-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        @keyframes slideUp {
            from { 
                opacity: 0;
                transform: translateY(30px);
            }
            to { 
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
    <div class="game-container">
        <h2>闪灵快手 - Geistes</h2>
        <!-- 卡牌显示区 -->
        <div class="geistes-card" id="current-card">
            <img id="current-card-img" src="" alt="卡牌图片" class="card-image">
        </div>
        <!-- Token抢选区 -->
        <div class="geistes-tokens">
            <!-- 每个 Token 用 img 标签显示图片，data-token 保留编号用于逻辑判断 -->
            <div class="geistes-token" data-token="1">
                <img src="/images/geistes/token1.png" alt="Token 1">
                <img src="/images/geistes/right.png" alt="正确" class="token-checkmark"> <!-- 对勾 -->
                <img src="/images/geistes/wrong.png" alt="错误" class="token-cross"> <!-- 叉号 -->
                <div class="token-player-label"></div> <!-- 玩家标签 -->
            </div>
            <div class="geistes-token" data-token="2">
                <img src="/images/geistes/token2.png" alt="Token 2">
                <img src="/images/geistes/right.png" alt="正确" class="token-checkmark"> <!-- 对勾 -->
                <img src="/images/geistes/wrong.png" alt="错误" class="token-cross"> <!-- 叉号 -->
                <div class="token-player-label"></div> <!-- 玩家标签 -->
            </div>
            <div class="geistes-token" data-token="3">
                <img src="/images/geistes/token3.png" alt="Token 3">
                <img src="/images/geistes/right.png" alt="正确" class="token-checkmark"> <!-- 对勾 -->
                <img src="/images/geistes/wrong.png" alt="错误" class="token-cross"> <!-- 叉号 -->
                <div class="token-player-label"></div> <!-- 玩家标签 -->
            </div>
            <div class="geistes-token" data-token="4">
                <img src="/images/geistes/token4.png" alt="Token 4">
                <img src="/images/geistes/right.png" alt="正确" class="token-checkmark"> <!-- 对勾 -->
                <img src="/images/geistes/wrong.png" alt="错误" class="token-cross"> <!-- 叉号 -->
                <div class="token-player-label"></div> <!-- 玩家标签 -->
            </div>
            <div class="geistes-token" data-token="5">
                <img src="/images/geistes/token5.png" alt="Token 5">
                <img src="/images/geistes/right.png" alt="正确" class="token-checkmark"> <!-- 对勾 -->
                <img src="/images/geistes/wrong.png" alt="错误" class="token-cross"> <!-- 叉号 -->
                <div class="token-player-label"></div> <!-- 玩家标签 -->
            </div>
        </div>
        <!-- 分数面板 -->
        <div class="geistes-scores" id="score-panel"></div>
        <!-- 提示消息 -->
        <div class="message-area" id="game-message"></div>
        <!-- 离开按钮 -->
        <div class="game-actions">
            <!-- <button id="leave-game-btn" style="display: block; margin: 20px auto;">离开游戏</button> -->
            <button id="help-btn" class="help-button" style="display: block; margin: 10px auto;">❓ 说明书</button>
        </div>
    </div>
    <script type="module" src="/js/main.js"></script>
</body>
</html>